package ch.bfh.abhmcm.SoftwareEngineeringAndDesign.controller;

import ch.bfh.abhmcm.SoftwareEngineeringAndDesign.controller.database.DatabaseConnection;
import ch.bfh.abhmcm.SoftwareEngineeringAndDesign.model.News;
import ch.bfh.abhmcm.SoftwareEngineeringAndDesign.model.RFC;

public class NewsCommiter {
	
	public void makeAndcommitANews(RFC rfc, String from, String to, String reason, String message) {
		
		String querry2 = "INSERT INTO `cms_news`(`" + News.TC_RFC_ID + "`, `"
				+ News.TC_FROM + "`, `" + News.TC_TO +"`, `" + News.TC_TITLE + "`, `"
				+ News.TC_MESSAGE + "`, `" + News.TC_KNOWN + "`) VALUES ('"
				+ rfc.getIdRFC() + "', '" + from + "', '"
				+ rfc.getRfc_Initiator() + "', 'Abweisung', '" + message + "', 'false');";
	

		DatabaseConnection connection2 = new DatabaseConnection();
		connection2.connect();

		connection2.insertquery(querry2);

		connection2.disconnect();
		
	}

}
